<template>
	<view class="container">
		
		<!-- 上报信息 -->
		<view class="form-section" style="margin-top: 20rpx;">
		  <view class="form-title">上报信息</view>
		  
		  <!-- 上报地址 -->
		  <view class="weui-cell">
			<view class="weui-cell__hd">
			  <view class="weui-label">上报地址</view>
			</view>
			<view class="weui-cell__bd">
			  <input
				class="weui-input"
				placeholder="请输入上报地址"
				v-model="reportForm.reportAddress"
			  />
			</view>
		  </view>
		  <!-- 上报原因 -->
		  <view class="weui-cell">
			<view class="weui-cell__hd">
			  <view class="weui-label">上报原因</view>
			</view>
			<view class="weui-cell__bd">
			  <input
				class="weui-input"
				placeholder="请输入上报原因"
				v-model="reportForm.reason"
			  />
			</view>
		  </view>
		  
		  <!-- 联系电话 -->
		  <view class="weui-cell">
			<view class="weui-cell__hd">
			  <view class="weui-label">联系电话</view>
			</view>
			<view class="weui-cell__bd">
			  <input
				class="weui-input"
				placeholder="请输入联系电话"
				v-model="reportForm.contact"
			  />
			</view>
		  </view>		
		  
		  <!-- 上报 -->
		  <view class="weui-cell">
			<!-- 默认按钮 -->
			<a href="javascript:;" class="weui-btn weui-btn_large weui-btn_primary" @click="reportFun()">上报</a>
		  </view>		
		  
		  
		</view>
	</view>
</template>

<script>
import { setReport  } from '@/api/system/report'
export default {
	
	
	data() {
		return {
			reportId: '', //堆场ID
			reportForm: {
				reportAddress : null,  //上报地址
				reason : null,  //上报原因
				contact : null,  //联系电话
			},

		}
	},
	onLoad(query) {
		this.reportId = query.id
		this.reportForm.yardId = query.id
	},
	methods: {
		
		reportFun(){
			setReport(this.reportForm).then(response => {
				if(response.code==200){
					// uni.showToast({ icon: 'success', title: '操作成功',duration:3000 });
					// setTimeout(()=>{
					// 	uni.navigateBack();
					// },2000)
					
					setTimeout(() => {
					  uni.showToast({ title: '上报成功', icon: 'success' });
					  setTimeout(() => uni.navigateBack(), 2000); // 延迟跳转
					}, 100);
				}else{
					uni.showToast({
					  title:response.msg,
					  icon:'none'
					})
				}
			}).finally(() => {
				uni.hideLoading();
			});
		}
	}
}
</script>

<style scoped lang="scss">
/* 保持原有样式不变 */
.container {
	padding: 20rpx;
}

.form-section {
	margin-bottom: 40rpx;
	background: #fff;
	border-radius: 16rpx;
	padding: 20rpx;
	box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
}

.form-title {
	font-size: 32rpx;
	font-weight: bold;
	padding: 20rpx 0;
	border-bottom: 2rpx solid #eee;
}

.weui-btn_large {
	width: 100%;
	background: #007AFF;
}
.weui-btn_primary:not(.weui-btn_disabled):visited{
  color:#FFFFFF;
}
.weui-btn_primary:not(.weui-btn_disabled):active{
  color:#FFFFFF;
  background-color:#1975da;
}
</style>